﻿@using QDT.Core
@using QDT.Core.Assignments
@using QDT.Core.Projects
@model QDT.Common.IPagedList<QDT.Core.Assignments.Assignment>
@{
    int i = 1;
}
<div class="ui-assign-tb" style="clear: both;">
    <table>
        <tr style="border: none;">
            <th style="width: 250px;">
                转让项目
            </th>
@*            <th>*@
@*                安全保障*@
@*            </th>*@
            <th>
                预期年化收益率
            </th>
            <th>
                剩余时间
            </th>
            <th>
                转让价格
            </th>
            <th>
                转让进度
            </th>
            <th style="width: 120px;">
            </th>
        </tr>
        @foreach (Assignment assign in Model)
        {
            Project project = Html.F().GetProject(assign.ProjectId);
            var agency = Html.F().GetAgency(project.Parent.AgencyId);
            
            <tr style="" class="assigns_tr_hover2">
                <td style="text-align: left; padding-left: 28px;">
                    @if (project.TypeID == 2)
                    {
                        <span class="ui-badge ui-badge-orange" title="资产抵押">押</span>
                    }
                    @if (project.TypeID == 3 || project.TypeID == 9 || project.TypeID == 10)
                    {
                        <span class="ui-badge ui-badge-green" title="机构担保">保</span>
                    }
                    <a href="@Url.Action("Index", "Assignment", new { id = assign.ID })">@project.Name</a>
                </td>
@*                <td>*@
@*                    @(agency == null ? "资产抵押" : agency.SubName)*@
@*                </td>*@
                <td>
                    10%-18%
                </td>
                <td>@((project.RepayEndTime.Value.Date - DateTime.Now.Date).Days >= 0 ? ((project.RepayEndTime.Value.Date - DateTime.Now.Date).Days) : 0)天</td>
                <td>@assign.Money.ToMoney()</td>
                <td style="width: 100px;">
                    <!--<div style="width: 120px; border: 1px solid #F8B3D0; height: 12px; margin-left: 50px;">
                            <em style="width: @(project.Progress.ToString("0.0") + '%'); display: block; background: #ffa010; height: 100%;                                                                                                                                                                                                                                                                                                                                                                                                                                                                    text-align: center;line-height: 40px;">@(project.Progress.ToString("0.0") + '%')</em>
                        </div>-->
                    <div id="@("assigns_" + i)" style="height: 60px;width: 100px;margin-left: 10px;">
                    </div>
                </td>
                <td>
                    @if (assign.Status == AssignmentStatus.Cancel)
                    {
                        <a href="javascript:;" class="ui-button ui-button-disable assgin-tb">已结束</a>
                    }
                    @if (assign.Status == AssignmentStatus.Completed)
                    {
                        <a href="javascript:;" class="ui-button ui-button-disable assgin-tb">已卖出</a>
                    }
                    @if (assign.Status == AssignmentStatus.Progress)
                    {
                        if (assign.EndTime <= DateTime.Now)
                        {
                        <a href="javascript:;" class="ui-button ui-button-disable assgin-tb">已结束</a>
                        }
                        else
                        {
                        <a href="@Url.Action("Index", "Assignment", new { id = assign.ID })" class="ui-button ui-button-orange assgin-tb">
                            购买</a>
                        }
                    }
                </td>
            </tr>
            
            <script type="text/javascript">
        $("#@("assigns_" + i)").ready(function() {
            var@("assigns_" + i) = new JustGage({
                id: "@("assigns_" + i)",
                value: @assign.Progress.ToString("0.0"),
                title:" ",
                showMinMax:false,           
                label: "",
                showInnerShadow: false,
                levelColors: [
                    "#2ecc71",
                    "#f1c40f",
                    "#e74c3c"
                ],
                gaugeWidthScale: 0.5
            });
        });
            </script>
            
                  i++;
        }
    </table>
</div>
